<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
<base href="http://test.youxiduo.com/iweb/shi_xin_bu_chang/"/>
<!--<base href="http://h5.youxiduo.com/special/shihou/promoter/3067/"/>-->
<!--<base href="http://resource.youxiduo.com/special/shihou/promoter/3067/"/>-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name = "format-detection" content = "telephone=no">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport"  content="width=device-width,user-scalable=no">
<title>狮吼主播2017全新启航直播时薪翻倍</title>
<meta name="keywords" content="游戏多">
<meta name="description" content="游戏多">
<link rel="stylesheet" href="static/css/base.css" />
<link rel="stylesheet" href="static/css/style.css" />
<script src="static/js/jquery-1.7.1.min.js"></script>
</head>
<body class="phbBody">
    
	<div class="wrap"> 
    	<header class="header">
        	<img src="static/img/bgImg1.jpg" />
        </header>
        <section class="sec">
        	<ul class="phbList">
            	<!--<li class="no1"><em class="no"></em><em class="phbUser"><img src="static/img/shHead.jpg" /></em><span class="phbName">周二科</span><a href="#" class="statePlay"></a></li>
            	<li class="no2"><em class="no"></em><em class="phbUser"><img src="static/img/shHead.jpg" /></em><span class="phbName">周二科</span><a href="#" class="statePlay"></a></li>
            	<li class="no3"><em class="no"></em><em class="phbUser"><img src="static/img/shHead.jpg" /></em><span class="phbName">周二科</span><a href="#" class="statePlay"></a></li>
            	<li class="no4"><em class="no">4</em><em class="phbUser"><img src="static/img/shHead.jpg" /></em><span class="phbName">周二科</span><a href="#" class="statePlayNo"></a></li>
            	<li class="no4"><em class="no">5</em><em class="phbUser"><img src="static/img/shHead.jpg" /></em><span class="phbName">周二科</span><a href="#" class="statePlayNo"></a></li>
            	<li class="no4"><em class="no">6</em><em class="phbUser"><img src="static/img/shHead.jpg" /></em><span class="phbName">周二科</span><a href="#" class="statePlayNo"></a></li>
            	<li class="no4"><em class="no">7</em><em class="phbUser"><img src="static/img/shHead.jpg" /></em><span class="phbName">周二科</span><a href="#" class="statePlayNo"></a></li>
            	<li class="no4"><em class="no">8</em><em class="phbUser"><img src="static/img/shHead.jpg" /></em><span class="phbName">周二科</span><a href="#" class="statePlayNo"></a></li>
            	<li class="no4"><em class="no">9</em><em class="phbUser"><img src="static/img/shHead.jpg" /></em><span class="phbName">周二科</span><a href="#" class="statePlayNo"></a></li>
            	<li class="no4"><em class="no">10</em><em class="phbUser"><img src="static/img/shHead.jpg" /></em><span class="phbName">周二科</span><a href="#" class="statePlayNo"></a></li>-->
            </ul>
            <a class="btnLoad">点击加载更多</a>
            <span class="listEnd">亲已经到底了哦~</span>
        </section>
        <footer class="footer" style="display:none1;">
        	<div class="footerWrap">
                <img src="static/img/footerBg.png" />
                <!-- 登录 未直播有排行 -->
                <!--<!-- 登录 有排名 -- >
                <div class="login">
                    <div class="loginWrap">
                        <em class="phbUser"><img src="static/img/shHead.jpg" /></em><span class="phbName">周二科周二科周二</span><span class="tPm">昨日排名：1000名</span>
                    </div>
                </div>
                <!-- 登录 暂未上榜 -- >
                <div class="login" style="display:none;">
                    <div class="loginWrap">
                        <em class="phbUser"><img src="static/img/shHead.jpg" /></em><span class="phbName">周二科周二科周二</span><span class="tPm">昨日排名：暂未上榜</span>
                    </div>
                </div>
                <!-- 未登录 -- >
                <div class="login" style="display:none;">
                    <div class="loginWrap">
                        <em class="phbUser2"><img src="static/img/shHead2.jpg" /></em><span>请登录后查看个人排名</span>
                    </div>
                </div>-->
            </div>
        </footer>
    </div>
    <input type="text" style="display: none;" value="0" id="startOffset" /><!-- 当前页 -->
    <input type="text" style="display: none;" value="10" id="pageSize" /><!-- 页大小 -->
</body>
</html>
<script>
	
	//获取url中的参数
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
    }
	
	var share_icon = getUrlParam('share_icon');
	var share_title = getUrlParam('share_title');
	var share_desc = getUrlParam('share_desc');
	var plan_Id = getUrlParam('plan_Id');
	var share_conf_id = getUrlParam('share_conf_id');
	var signed = getUrlParam('signed');
	var share_open = getUrlParam('share_open');
	var from_user_id = getUrlParam('from_user_id');//244269
	var share_url = getUrlParam('share_url');
</script>
<script src="static/js/base.js"></script>
<script>
	var base;
	$(function(){
		base = new Base();
		
		//个人排行 
		//未登录
		if(from_user_id == "0"){
			console.log("用户未登录");
			var html = '<div class="login">'+
                    '<div class="loginWrap">'+
                        '<em class="phbUser2"><img src="static/img/shHead2.jpg" /></em>请登录后查看个人排名'+
                    '</div>'+
                '</div>';
            $('.footerWrap').append(html).show().siblings().hide();   
		}else{//已登录
			console.log("用户已登录");
			loadUserRank();
		}
		
		loadData1();
		$(".btnLoad").live("click", function(){
			loadData2();	
		});
	});
	
	//加载个人排名
	function loadUserRank(){
		var date = {"activityId":share_conf_id, "userId":from_user_id, "planId":plan_Id, "startDate":base.preDate(), "endDate":base.preDate()};
		base.requestRemoteDataJson(base.userCenterURL, date, function(result){
			base.logResult(result);
			var html = '';
		    if(result.errorCode == "0"){
		    	result = result.result;
		    	
		        html += '<div class="login" style="display:;">';
                html += '    <div class="loginWrap">';
                
                html += '		 <em class="phbUser">';
                html += '		 	<img src="'+base.parseResult(result, 'userInfo', 'avatar')+'" />';
                html += '		 </em>';
                html += '		 <span class="phbName">'+base.parseResult(result, 'userInfo', 'nick_name')+'</span>';
                if(result.userRank != 0){
                	html += '        <em class="tPm">昨日排名：'+base.parseResult(result, 'userRank')+'</em>';
                }else{
					html += '        <em class="tPm">昨日排名：暂未上榜</em>';                	
                }
                html += '    </div>';
                html += '</div>';
                
		    }
		    $('.footerWrap').append(html).show().siblings().hide();
		});
	}
	
	//首次加载榜单
	function loadData1(){
		var data = {"startOffset": $("#startOffset").val(), "pageSize":$("#pageSize").val(), "startDate":base.preDate(), "endDate":base.preDate(), "activityId":share_conf_id};
		//var data = {"startOffset": 0, "pageSize":50, "startDate":base.preDate(), "endDate":base.preDate(), "activityId":share_conf_id};
		base.requestRemoteDataJson(base.rankURL, data, function(data){
			var pageNow = parseInt($("#startOffset").val());
			var pageSize = parseInt($("#pageSize").val());
			base.logResult(data);
			if(data.errorCode == "0"){
				result = data.result;
				if(result != undefined){
					var html = '';
					for(var i = 0;i < result.length;i++){
						var user = result[i];
						html += '<li class="no'+((i+1)>4?4:(i+1))+'">';
						var num = ((pageNow*pageSize)+(i+1));
						if(num < 4){
							html += '	<em class="no"></em>';	
						}else{
							html += '	<em class="no">'+num+'</em>';
						}
						html += '	<em class="phbUser">';
						html += '		<img src="'+base.parseResult(user, 'userInfo', 'avatar')+'" />';
						html += '	</em>';
						html += '	<span class="phbName">'+base.parseResult(user, 'userInfo', 'nick_name')+'</span>';
						if(base.parseResult(user, 'userInfo', 'room', 'vdo_status') == '1'){
							html += '	<a href="'+base.parseResult(user, 'userInfo', 'room', 'jump')+'" class="statePlay"></a>';	
						}else{
							html += '	<a href="'+base.parseResult(user, 'userInfo', 'room', 'jump')+'" class="statePlayNo"></a>';
						}
						html += '</li>';
					}
				}
			}
			$('.phbList').html(html);
			$("#startOffset").val(pageNow+1);
		});
	}
	//点击【加载更多】
	function loadData2(){
		if($("#startOffset").val() >= 5){
			$('.btnLoad').hide();
			$('.listEnd').css({"display":"block"});
			return;
		}
		var data = {"startOffset": $("#startOffset").val(), "pageSize":$("#pageSize").val(), "startDate":base.preDate(), "endDate":base.preDate(), "activityId":share_conf_id};
		//var data = {"startOffset": , "pageSize":150, "startDate":base.preDate(), "endDate":base.preDate(), "activityId":share_conf_id};
		base.requestRemoteDataJson(base.rankURL, data, function(data){
			var pageNow = parseInt($("#startOffset").val());
			var pageSize = parseInt($("#pageSize").val());
			base.logResult(data);
			if(data.errorCode == "0"){
				result = data.result;
				if(result != undefined){
						var html = '';
						for(var i = 0;i < result.length;i++){
							var user = result[i];
							html += '<li class="no4">';
							var num = ((pageNow*pageSize)+(i+1));
							html += '	<em class="no">'+num+'</em>';
							html += '	<em class="phbUser">';
							html += '		<img src="'+base.parseResult(user, 'userInfo', 'avatar')+'" />';
							html += '	</em>';
							html += '	<span class="phbName">'+base.parseResult(user, 'userInfo', 'nick_name')+'</span>';
							if(base.parseResult(user, 'userInfo', 'room', 'vdo_status') == '1'){
								html += '	<a href="'+base.parseResult(user, 'userInfo', 'room', 'jump')+'" class="statePlay"></a>';	
							}else{
								html += '	<a href="'+base.parseResult(user, 'userInfo', 'room', 'jump')+'" class="statePlayNo"></a>';
							}
							html += '</li>';
						}
						$('.phbList').append(html);
						$("#startOffset").val(pageNow+1);
						if(pageNow >= 4){
							$('.btnLoad').hide();
							$('.listEnd').css({"display":"block"});
							return;
						}
				}else{
					$('.btnLoad').hide();
					$('.listEnd').css({"display":"block"});						
				}
			}
			
		});
	}
</script>